package com.gxa.service.impl;

import com.gxa.dao.ResourceMapper;
import com.gxa.pojo.Resource;
import com.gxa.pojo.ResourceVO;
import com.gxa.service.ResourceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service("Resource")
public class ResourceServiceImpl implements ResourceService {
    @Autowired
    ResourceMapper resourceMapper;

    @Override
    public List<Resource> showResource(ResourceVO resourceVO) {
        List<Resource> resources=resourceMapper.showResource(resourceVO);
        return resources;
    }

    @Override
    public int getCount() {
        return resourceMapper.getCount();
    }

    @Override
    public List<Resource> selectByCondition(ResourceVO resourceVO) {
        return resourceMapper.selectByCondition(resourceVO);
    }

    @Override
    public Boolean deleteByResourceName(String resourceName) {
        int row=resourceMapper.deleteByResourceName(resourceName);
        if(row>0){
            return true;
        }else {
            return false;
        }

    }

    @Override
    public Boolean addResource(Resource resource) {
        int row=resourceMapper.addResource(resource);
        if(row>0){
            return true;
        }else {
            return false;
        }

    }

    @Override
    public Resource selectByResourceName(String resourceName) {
        Resource resource=resourceMapper.selectByResourceName(resourceName);
        return resource;
    }
}
